﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
//using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Typeof
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 查看 Int32 类的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            Type type = typeof(System.Int32);
            MethodInfo[] infos = type.GetMethods();
            foreach(var info in infos)
            {
                richBox.AppendText($"方法名称:{info.Name} - {Environment.NewLine}");
                foreach(var param in info.GetParameters())
                {
                    richBox.AppendText($"参数:{param.Name} - {Environment.NewLine}");
                }
            }
        }

        /// <summary>
        /// 清除所有TextBox内容
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            foreach (Control c in Controls)
            {
                if (c.GetType() == typeof(TextBox))
                {
                    (c as TextBox).Clear();
                }
            }
        }
    }
}
